home *** CD-ROM | disk | FTP | other *** search
- #include "xtcl.h"
-
- /*
- * Simple XTCL. Merely concatenates its arguments, separated by spaces.
- * To run, use the Tcl shell to cd to the 'xtcls' direcotry and type
- * "xtclcmd -f :concat Concat one two three"
- */
-
- void
- main(argc, argv, xpb)
- long argc;
- char **argv;
- XTCLParmBlk *xpb;
- {
- char *ptr, state;
- long i, length, slen;
-
- xpb->result = TCL_OK;
- length = GetHandleSize(xpb->resultH);
-
- for (i = 1, slen = 0; i < argc; i++)
- {
- slen += strlen(argv[i]) + 1;
- }
- slen++;
-
- // make power of four for luck's sake
- slen += (sizeof(int) - (slen % sizeof(int)));
- SetHandleSize(xpb->resultH, (long)slen);
-
- state = HGetState(xpb->resultH);
- HLock(xpb->resultH);
-
- for (ptr=*xpb->resultH, i=1; i < argc; i++) {
- strcat(ptr, argv[i]);
- strcat(ptr, " ");
- ptr += strlen(ptr);
- }
-
- HSetState(xpb->resultH, state);
- }
-
-
-